from selenium import webdriver;
from selenium.webdriver import ActionChains;
from lxml import etree;
import time;

bro = webdriver.Chrome(executable_path="./chromedriver.exe");

# iframe
bro.get("https://music.163.com/");
# 切换作用域
bro.switch_to.frame("g_iframe");
# ul = bro.find_element_by_css_selector(".m-cvrlst");
# ul.text

page_text = bro.page_source;
html = etree.HTML(page_text);
lis = html.xpath("//ul/li");

for li in lis:
    text = li.xpath("./p[@class='dec']/a/text()");
    if len(text) > 0:
        print(text[0].strip());

# 动作链
bro.get("http://www.ab173.com/other/huaban.php");
canvas = bro.find_elements_by_id("canvas");

# 初始化动作链
action = ActionChains(bro);
# action.click_and_hold();
action.move_by_offset(500,2000).perform();

# 释放动作链
action.release();

time.sleep(3);
bro.quit();